//
//  sendChatVoice.m
//  tcpoctest
//
//  Created by gump on 5/23/13.
//  Copyright (c) 2013 gump. All rights reserved.
//

#import "sendChatVoice.h"
#import "taskDataSource.h"

@implementation sendChatVoice

-(void)SendChatVoice:(NSString *)fileurl withMail:(NSString *)mail
{
    if (![self CheckLogin]) {
        return;
    }
    
    NSData *voice = [NSData dataWithContentsOfFile:fileurl];
    
    int l = CHAR_PL * 3 +  [mail length] + [voice length] + INT_PL * 2;
    
    [self initDataUseCurSequence:l];
    
    [sb WriteChar:[mail length]];
    [sb WriteString:mail withLength:[mail length]];
    [sb WriteInt:[voice length] withNTT:NTT_SMALL2BIG];
    [sb WriteData:(char *)[voice bytes] withLength:[voice length]];
    
    [self Package];
    
    [[DataControl shareControl].taskDS CompleteTaskByID:TI_F_CHAT_SOUND
     withIsDirectShow:false];
}


@end
